package com.oren.Thread.study.day02;

/**
 * Created by IntelliJ IDEA.
 * User: wangshiwei
 * Date: 2018/8/6
 * Time: 14:40
 * describe:
 */
public class MyObject {

    public synchronized  void method1(){
        try {
            System.out.println(" begin method1 threadName ="+Thread.currentThread().getName());
            Thread.sleep(5000);
            System.out.println("end endTime ="+System.currentTimeMillis());
        }catch (Exception e){
            e.printStackTrace();
        }
    }

    public synchronized void method2(){
        try {
            System.out.println("begin methodB threadName="+Thread.currentThread().getName());
            Thread.sleep(5000);
            System.out.println("end ");
        }catch (Exception e){
            e.printStackTrace();
        }
    }

}
